Sort listView

The setSortColumn(listView, colNum) doesn't seem to sort the listView... is there something else I have to call to refresh the view or something?

Does this function work for anyone else on version 9.3?

Thanks,
Steve
StephenValliere - Tue Apr 26 13:34:46 EDT 2011

Re: Sort listView
llandale - Tue Apr 26 14:25:07 EDT 2011

[] The ListView DBE must be created with option listViewOptionSortText.
[] You need to write your own sort function. It must look just about exactly as the one below, so you might as well just use the one below (changing the name). Don't know exactly what is wrong, but in the past I've made some tweaks to the function and for some reason it just stops working.
[] The Column must be defined also as allowing sorting:
set(dbeListView, ColNum, fDbeLv_clbkSortFunction) // Allow sorting this column

-Louie
 

//*******************
int    fDbeLv_clbkSortFunction(string s1, s2)
{     // Standard sort function when defining a column as sortable.
        // Developers Note: Some code if added herein will cause DXL exception Violations.
        //      Don't understand why, but this function needs to be kept as-is.
        int     Result
        if     (s1 == s2) Result =  0
        elseif (s1 >  s2) Result =  1
        elseif (s1 <  s2) Result = -1
        else{} // all cases covered
        return(Result)
}  // end fDbeLv_clbkSortFunction()

Re: Sort listView
StephenValliere - Wed Apr 27 08:36:28 EDT 2011

llandale - Tue Apr 26 14:25:07 EDT 2011

[] The ListView DBE must be created with option listViewOptionSortText.
[] You need to write your own sort function. It must look just about exactly as the one below, so you might as well just use the one below (changing the name). Don't know exactly what is wrong, but in the past I've made some tweaks to the function and for some reason it just stops working.
[] The Column must be defined also as allowing sorting:
set(dbeListView, ColNum, fDbeLv_clbkSortFunction) // Allow sorting this column

-Louie
 

//*******************
int    fDbeLv_clbkSortFunction(string s1, s2)
{     // Standard sort function when defining a column as sortable.
        // Developers Note: Some code if added herein will cause DXL exception Violations.
        //      Don't understand why, but this function needs to be kept as-is.
        int     Result
        if     (s1 == s2) Result =  0
        elseif (s1 >  s2) Result =  1
        elseif (s1 <  s2) Result = -1
        else{} // all cases covered
        return(Result)
}  // end fDbeLv_clbkSortFunction()

Thanks Louie, that worked great.

Re: Sort listView
Thosicus - Fri Apr 06 17:22:18 EDT 2012

llandale - Tue Apr 26 14:25:07 EDT 2011

[] The ListView DBE must be created with option listViewOptionSortText.
[] You need to write your own sort function. It must look just about exactly as the one below, so you might as well just use the one below (changing the name). Don't know exactly what is wrong, but in the past I've made some tweaks to the function and for some reason it just stops working.
[] The Column must be defined also as allowing sorting:
set(dbeListView, ColNum, fDbeLv_clbkSortFunction) // Allow sorting this column

-Louie
 

//*******************
int    fDbeLv_clbkSortFunction(string s1, s2)
{     // Standard sort function when defining a column as sortable.
        // Developers Note: Some code if added herein will cause DXL exception Violations.
        //      Don't understand why, but this function needs to be kept as-is.
        int     Result
        if     (s1 == s2) Result =  0
        elseif (s1 >  s2) Result =  1
        elseif (s1 <  s2) Result = -1
        else{} // all cases covered
        return(Result)
}  // end fDbeLv_clbkSortFunction()

Thanks Louie -- your code is still helping folks (like me) a year later.

Re: Sort listView
SystemAdmin - Thu Nov 29 01:47:08 EST 2012

I am using a Checkboxes listView but defining the above sort function also My list is not getting sorted.. Please help below is my
listView definition
filesCheck1 = listView(pizzaBox, listViewOptionCheckboxes|listViewOptionSortText, 400,10, nonMembersStrArray)

Re: Sort listView
llandale - Thu Nov 29 12:46:51 EST 2012

SystemAdmin - Thu Nov 29 01:47:08 EST 2012
I am using a Checkboxes listView but defining the above sort function also My list is not getting sorted.. Please help below is my
listView definition
filesCheck1 = listView(pizzaBox, listViewOptionCheckboxes|listViewOptionSortText, 400,10, nonMembersStrArray)

You need to do all 3 steps I outlined above; specifically define each column that is to be sortable.

Re: Sort listView
SystemAdmin - Fri Nov 30 00:42:41 EST 2012

llandale - Thu Nov 29 12:46:51 EST 2012
You need to do all 3 steps I outlined above; specifically define each column that is to be sortable.

Thank you very much :)